include(FindPkgConfig)
pkg_check_modules(PC_DRM DRM)

find_path(DRM_INCLUDE_DIRS
    NAMES drm.h
    HINTS ${PC_DRM_INCLUDEDIR}
    ${PC_DRM_INCLUDE_DIRS}
    PATH_SUFFIXES drm
)

find_library(DRM_LIBRARIES
    NAMES drm
    HINTS ${PC_DRM_LIBDIR}
    ${PC_DRM_LIBRARY_DIRS}
)
if(DRM_INCLUDE_DIRS AND DRM_LIBRARIES)
    set(DRM_FOUND TRUE)
    set(DRM_LIBRARY ${DRM_LIBRARIES})
    set(DRM_INCLUDE_DIR ${DRM_INCLUDE_DIRS})
    set(DRM_VERSION ${PC_DRM_VERSION})
    include(FindPackageHandleStandardArgs)
    FIND_PACKAGE_HANDLE_STANDARD_ARGS(DRM FOUND_VAR DRM_FOUND VERSION_VAR DRM_VERSION
	    REQUIRED_VARS DRM_INCLUDE_DIRS DRM_INCLUDE_DIR DRM_LIBRARIES DRM_LIBRARY)

    mark_as_advanced(DRM_LIBRARIES DRM_LIBRARY DRM_INCLUDE_DIRS DRM_INCLUDE_DIR DRM_VERSION)
endif()

